package com.zxy.ziems.server.statistics.controller;

import com.zxy.ziems.server.constant.enums.DictCodeEnum;
import com.zxy.ziems.server.dto.DataQueryDto;
import com.zxy.ziems.server.energy.service.DataChartDictService;
import com.zxy.ziems.server.vo.ChartVo;
import com.zxy.ziems.server.vo.ReportVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 动力各科-空调科-空调科
 *
 * @Copyright (C),
 * @ClassName: AirController
 * @Author: yanzhiwei
 * @Description:
 * @Date: 2024/6/11 10:24
 */

@RestController
@Validated
@RequestMapping("/api/air")
public class AirController {
    @Autowired
    private DataChartDictService dataChartDictService;

    /**
     * （总量查询）排风系统能耗，冷源水耗，
     *
     * @return
     */
    @GetMapping("/exhaustSystem")
    public ChartVo exhaustSystem(DataQueryDto dataQueryDto) {
        return dataChartDictService.thisData(dataQueryDto);
    }

    /**
     * 热水系统能耗
     *
     * @return
     */
    @GetMapping("/hotWater")
    public ChartVo hotWater(DataQueryDto dataQueryDto) {
        dataQueryDto.setDictCode(DictCodeEnum.CARBON_EMISSION.getCode());
        return dataChartDictService.compareBarChart(dataQueryDto);
    }

    /**
     * 二次泵系统能耗
     *
     * @return
     */
    @GetMapping("/secondaryPump")
    public ChartVo secondaryPump(DataQueryDto dataQueryDto) {
        dataQueryDto.setDictCode(DictCodeEnum.CARBON_EMISSION.getCode());
        return dataChartDictService.compareBarChart(dataQueryDto);
    }

    /**
     * 室外温湿度(曲线)
     *
     * @return
     */
    @GetMapping("/temperatureAndHumidity")
    public ChartVo temperatureAndHumidity(DataQueryDto dataQueryDto) {
        dataQueryDto.setDictCode(DictCodeEnum.CARBON_EMISSION.getCode());
        return dataChartDictService.compareBarChart(dataQueryDto);
    }

    /**
     * 室外温湿度(表格)
     *
     * @return
     */
    @GetMapping("/temperatureAndHumidityTable")
    public ReportVo temperatureAndHumidityTable(DataQueryDto dataQueryDto) {
        dataQueryDto.setDictCode(DictCodeEnum.CARBON_EMISSION.getCode());
        return dataChartDictService.compareChartReport(dataQueryDto);
    }


}
